import {createStore} from 'vuex'

const Store = createStore({
    state(){
        return {
            userName:"",
            logined:false
        }
    },
    getters :{
        isLogin: (state) =>{
            return state.logined;
        }
    },
    mutations: {
        clearUserInfo (state){
            state.userName = ""
            state.logined = false
        },
        registUserInfo(state, {name}){
            state.userName = name
            state.logined = true
        }
    }
})

export default Store